package com.example.automanagement.controller;

import com.example.automanagement.entity.AutoOrder;
import com.example.automanagement.service.OrderService;
import com.example.automanagement.service.TimeLineService;
import com.example.automanagement.util.Result;
import com.example.automanagement.views.TimeLineNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TimeLineController {
    @Autowired
    private TimeLineService timeLineService;

    @GetMapping(value = "/getTimeLine")
    public Result getTimeLine(@RequestParam("orderId") int orderId,@RequestParam("orderType") String orderType,@RequestParam("progress") int progress){
        try {
            List<TimeLineNode> timeLineNodes =timeLineService.getTimeLineNodeList(orderId,orderType,progress);
            return Result.success(timeLineNodes,"查询成功");
        } catch (Exception e) {
            return Result.error("500","查询失败！");
        }
    }
}
